package _0495_Teemo_Attacking;

/**
 * Date: 2021/9/17 10:12
 * Content:
 */
public class Solution {

    public int findPoisonedDuration(int[] s, int d) {
        int res = 0;
        for (int i = 1; i < s.length; i++) res += Math.min(s[i] - s[i - 1], d);
        if (s.length != 0) res += d;
        return res;
    }

    public static void main(String[] args) {

        int[] s = {1, 2};
        System.out.println((new Solution()).findPoisonedDuration(s, 2));  // 3
    }
}
